using System;
using System.Collections;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Windows.Forms;

namespace ImageUpload {

    public class ResizeSettingsControl : System.Windows.Forms.UserControl {
        private System.Windows.Forms.GroupBox gbResize;
        private System.Windows.Forms.Label lblJepgQuality;

        private System.Windows.Forms.Button btnQualityDefault;
        private System.Windows.Forms.Button btnThumbDefault;
        private System.Windows.Forms.Button btnBigDefault;

        private System.Windows.Forms.Label label1;
        private System.Windows.Forms.Label label2;
        private System.Windows.Forms.Label label3;
        private System.Windows.Forms.Label label4;
        private System.Windows.Forms.Label label13;

        private System.Windows.Forms.NumericUpDown nudBigHeight;
        private System.Windows.Forms.NumericUpDown nudBigWidth;
        private System.Windows.Forms.NumericUpDown nudThumbHeight;
        private System.Windows.Forms.NumericUpDown nudThumbWidth;
        private System.Windows.Forms.TrackBar tbJpegQuality;

        /// <summary> 
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.Container components = null;

        #region Properties
        public int BigHeight {
            get { return (int)nudBigHeight.Value; }
            set { nudBigHeight.Value = value; }
        }

        public int BigWidth {
            get { return (int)nudBigWidth.Value; }
            set { nudBigWidth.Value = value; }
        }

        public int ThumbHeight {
            get { return (int)nudThumbHeight.Value; }
            set { nudThumbHeight.Value = value; }
        }

        public int ThumbWidth {
            get { return (int)nudThumbWidth.Value; }
            set { nudThumbWidth.Value = value; }
        }

        public int JpegQuality {
            get { return tbJpegQuality.Value; }
            set { tbJpegQuality.Value = value; }
        }

        #endregion

        public ResizeSettingsControl() {
            // This call is required by the Windows.Forms Form Designer.
            InitializeComponent();

            // TODO: Add any initialization after the InitializeComponent call

        }

        /// <summary> 
        /// Clean up any resources being used.
        /// </summary>
        protected override void Dispose(bool disposing) {
            if (disposing) {
                if (components != null) {
                    components.Dispose();
                }
            }
            base.Dispose(disposing);
        }

        #region Component Designer generated code
        /// <summary> 
        /// Required method for Designer support - do not modify 
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent() {
            this.gbResize = new System.Windows.Forms.GroupBox();
            this.lblJepgQuality = new System.Windows.Forms.Label();
            this.label13 = new System.Windows.Forms.Label();
            this.btnQualityDefault = new System.Windows.Forms.Button();
            this.tbJpegQuality = new System.Windows.Forms.TrackBar();
            this.btnThumbDefault = new System.Windows.Forms.Button();
            this.btnBigDefault = new System.Windows.Forms.Button();
            this.label4 = new System.Windows.Forms.Label();
            this.label3 = new System.Windows.Forms.Label();
            this.nudBigHeight = new System.Windows.Forms.NumericUpDown();
            this.nudThumbHeight = new System.Windows.Forms.NumericUpDown();
            this.nudThumbWidth = new System.Windows.Forms.NumericUpDown();
            this.label2 = new System.Windows.Forms.Label();
            this.label1 = new System.Windows.Forms.Label();
            this.nudBigWidth = new System.Windows.Forms.NumericUpDown();
            this.gbResize.SuspendLayout();
            ((System.ComponentModel.ISupportInitialize)(this.tbJpegQuality)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.nudBigHeight)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.nudThumbHeight)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.nudThumbWidth)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.nudBigWidth)).BeginInit();
            this.SuspendLayout();
            // 
            // gbResize
            // 
            this.gbResize.Controls.Add(this.lblJepgQuality);
            this.gbResize.Controls.Add(this.label13);
            this.gbResize.Controls.Add(this.btnQualityDefault);
            this.gbResize.Controls.Add(this.tbJpegQuality);
            this.gbResize.Controls.Add(this.btnThumbDefault);
            this.gbResize.Controls.Add(this.btnBigDefault);
            this.gbResize.Controls.Add(this.label4);
            this.gbResize.Controls.Add(this.label3);
            this.gbResize.Controls.Add(this.nudBigHeight);
            this.gbResize.Controls.Add(this.nudThumbHeight);
            this.gbResize.Controls.Add(this.nudThumbWidth);
            this.gbResize.Controls.Add(this.label2);
            this.gbResize.Controls.Add(this.label1);
            this.gbResize.Controls.Add(this.nudBigWidth);
            this.gbResize.Location = new System.Drawing.Point(8, 8);
            this.gbResize.Name = "gbResize";
            this.gbResize.Size = new System.Drawing.Size(280, 120);
            this.gbResize.TabIndex = 6;
            this.gbResize.TabStop = false;
            this.gbResize.Text = "Resize Settings";
            // 
            // lblJepgQuality
            // 
            this.lblJepgQuality.Location = new System.Drawing.Point(16, 88);
            this.lblJepgQuality.Name = "lblJepgQuality";
            this.lblJepgQuality.Size = new System.Drawing.Size(32, 23);
            this.lblJepgQuality.TabIndex = 16;
            this.lblJepgQuality.Text = "(75)";
            // 
            // label13
            // 
            this.label13.Location = new System.Drawing.Point(8, 72);
            this.label13.Name = "label13";
            this.label13.Size = new System.Drawing.Size(40, 23);
            this.label13.TabIndex = 15;
            this.label13.Text = "Quality";
            // 
            // btnQualityDefault
            // 
            this.btnQualityDefault.Location = new System.Drawing.Point(166, 80);
            this.btnQualityDefault.Name = "btnQualityDefault";
            this.btnQualityDefault.Size = new System.Drawing.Size(101, 23);
            this.btnQualityDefault.TabIndex = 14;
            this.btnQualityDefault.Text = "Default";
            this.btnQualityDefault.Click += new System.EventHandler(this.btnQualityDefault_Click);
            // 
            // tbJpegQuality
            // 
            this.tbJpegQuality.Location = new System.Drawing.Point(48, 72);
            this.tbJpegQuality.Maximum = 100;
            this.tbJpegQuality.Minimum = 1;
            this.tbJpegQuality.Name = "tbJpegQuality";
            this.tbJpegQuality.Size = new System.Drawing.Size(112, 45);
            this.tbJpegQuality.TabIndex = 13;
            this.tbJpegQuality.TickFrequency = 5;
            this.tbJpegQuality.Value = 75;
            this.tbJpegQuality.ValueChanged += new System.EventHandler(this.tbJpegQuality_ValueChanged);
            // 
            // btnThumbDefault
            // 
            this.btnThumbDefault.Location = new System.Drawing.Point(166, 48);
            this.btnThumbDefault.Name = "btnThumbDefault";
            this.btnThumbDefault.Size = new System.Drawing.Size(101, 23);
            this.btnThumbDefault.TabIndex = 12;
            this.btnThumbDefault.Text = "Default";
            this.btnThumbDefault.Click += new System.EventHandler(this.btnThumbDefault_Click);
            // 
            // btnBigDefault
            // 
            this.btnBigDefault.Location = new System.Drawing.Point(166, 16);
            this.btnBigDefault.Name = "btnBigDefault";
            this.btnBigDefault.Size = new System.Drawing.Size(101, 23);
            this.btnBigDefault.TabIndex = 11;
            this.btnBigDefault.Text = "Default";
            this.btnBigDefault.Click += new System.EventHandler(this.btnBigDefault_Click);
            // 
            // label4
            // 
            this.label4.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(186)));
            this.label4.Location = new System.Drawing.Point(96, 16);
            this.label4.Name = "label4";
            this.label4.Size = new System.Drawing.Size(8, 16);
            this.label4.TabIndex = 10;
            this.label4.Text = "x";
            // 
            // label3
            // 
            this.label3.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(186)));
            this.label3.Location = new System.Drawing.Point(96, 48);
            this.label3.Name = "label3";
            this.label3.Size = new System.Drawing.Size(8, 16);
            this.label3.TabIndex = 9;
            this.label3.Text = "x";
            // 
            // nudBigHeight
            // 
            this.nudBigHeight.Location = new System.Drawing.Point(112, 16);
            this.nudBigHeight.Maximum = new decimal(new int[] {
            2000,
            0,
            0,
            0});
            this.nudBigHeight.Name = "nudBigHeight";
            this.nudBigHeight.Size = new System.Drawing.Size(48, 20);
            this.nudBigHeight.TabIndex = 8;
            this.nudBigHeight.Value = new decimal(new int[] {
            600,
            0,
            0,
            0});
            // 
            // nudThumbHeight
            // 
            this.nudThumbHeight.Location = new System.Drawing.Point(112, 48);
            this.nudThumbHeight.Maximum = new decimal(new int[] {
            1000,
            0,
            0,
            0});
            this.nudThumbHeight.Name = "nudThumbHeight";
            this.nudThumbHeight.Size = new System.Drawing.Size(48, 20);
            this.nudThumbHeight.TabIndex = 7;
            this.nudThumbHeight.Value = new decimal(new int[] {
            120,
            0,
            0,
            0});
            // 
            // nudThumbWidth
            // 
            this.nudThumbWidth.Location = new System.Drawing.Point(48, 48);
            this.nudThumbWidth.Maximum = new decimal(new int[] {
            1000,
            0,
            0,
            0});
            this.nudThumbWidth.Name = "nudThumbWidth";
            this.nudThumbWidth.Size = new System.Drawing.Size(48, 20);
            this.nudThumbWidth.TabIndex = 6;
            this.nudThumbWidth.Value = new decimal(new int[] {
            160,
            0,
            0,
            0});
            // 
            // label2
            // 
            this.label2.Location = new System.Drawing.Point(8, 48);
            this.label2.Name = "label2";
            this.label2.Size = new System.Drawing.Size(40, 16);
            this.label2.TabIndex = 5;
            this.label2.Text = "Thumb";
            // 
            // label1
            // 
            this.label1.Location = new System.Drawing.Point(8, 16);
            this.label1.Name = "label1";
            this.label1.Size = new System.Drawing.Size(24, 16);
            this.label1.TabIndex = 4;
            this.label1.Text = "Big";
            // 
            // nudBigWidth
            // 
            this.nudBigWidth.Location = new System.Drawing.Point(48, 16);
            this.nudBigWidth.Maximum = new decimal(new int[] {
            2000,
            0,
            0,
            0});
            this.nudBigWidth.Name = "nudBigWidth";
            this.nudBigWidth.Size = new System.Drawing.Size(48, 20);
            this.nudBigWidth.TabIndex = 3;
            this.nudBigWidth.Value = new decimal(new int[] {
            800,
            0,
            0,
            0});
            // 
            // ResizeSettingsControl
            // 
            this.Controls.Add(this.gbResize);
            this.Name = "ResizeSettingsControl";
            this.Size = new System.Drawing.Size(296, 136);
            this.gbResize.ResumeLayout(false);
            this.gbResize.PerformLayout();
            ((System.ComponentModel.ISupportInitialize)(this.tbJpegQuality)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.nudBigHeight)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.nudThumbHeight)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.nudThumbWidth)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.nudBigWidth)).EndInit();
            this.ResumeLayout(false);

        }
        #endregion

        private void btnBigDefault_Click(object sender, System.EventArgs e) {
            nudBigHeight.Value = 600;
            nudBigWidth.Value = 800;
        }

        private void btnThumbDefault_Click(object sender, System.EventArgs e) {
            nudThumbHeight.Value = 120;
            nudThumbWidth.Value = 160;
        }

        private void btnQualityDefault_Click(object sender, System.EventArgs e) {
            tbJpegQuality.Value = ThumbMaker.DEFAULTJPEGQUALITY;
        }

        private void tbJpegQuality_ValueChanged(object sender, System.EventArgs e) {
            lblJepgQuality.Text = "(" + tbJpegQuality.Value.ToString() + ")";
        }

    }
}
